/******************************************************************************/
/* ds1820_def.h                                                               */
/******************************************************************************/

#ifndef __DS1820_DEF_H
#define __DS1820_DEF_H


/******************************* Constants ************************************/
#define INIT_US_TIMER()         CORE::Init_Timer1()    // Init timer
#define DELAY_BIG_US(x)         CORE::RunTimer1((x))   // Delay hw
#define DELAY_MIN_US(x)         Delay((x)*15)          // Delay soft
#define DS1820_DELAY_EVENT      (0x00000001)

#define DS1820_ROMCODE_SIZE     (8)
#define DS18S20_ID              (0x10)
#define DS18B20_ID              (0x28)


/********************** Prototypes struct for DS1820 **************************/
typedef enum
{
    eDS_OK = 0,
    eDS_LAST_DEV = 0,
    eDS_PRESENCE_ERR,
    eDS_DATA_ERR,
    eDS_CRC_ERR,
    eDS_SEARCH_FIRST = 0xFF
} __eERR_DS1820;


typedef enum
{
    eDS_READ_ROM     = 0x33,
    eDS_CONVERT_TEMP = 0x44,
    eDS_MATCH_ROM    = 0x55,
    eDS_READ_TEMP    = 0xBE,
    eDS_SKIP_ROM     = 0xCC,
    eDS_SEARCH_ROM   = 0xF0
} __eCMD_DS1820;


#endif